//
//  GoodSuccessTableViewCell.m
//  shanHaiHuiApp
//
//  Created by DS on 2018/3/12.
//  Copyright © 2018年 徐双. All rights reserved.
//

#import "GoodSuccessTableViewCell.h"

@interface GoodSuccessTableViewCell()

Strong UIImageView * picImageView;
Strong UILabel * nameLabel;
Strong UILabel * countLabel;
Strong UILabel * moneyLabel;
Strong UIView * lineView;

@end

@implementation GoodSuccessTableViewCell

- (instancetype)initWithCellIdentifier:(NSString *)cellID{
    
    self = [super initWithCellIdentifier:cellID];
    
    if (self) {
        
        _picImageView = [UIImageView new];
        _picImageView.layer.masksToBounds = YES;
        _picImageView.image = [UIImage imageNamed:@"shanhaihuilogo"];
        
        
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.font = DEF_FontSize_14;
        _nameLabel.textColor = getColor(@"323232");
        _nameLabel.textAlignment = NSTextAlignmentLeft;
        _nameLabel.numberOfLines = 0;
        _nameLabel.text = @"三只松鼠";
        
        _countLabel = [[UILabel alloc] init];
        _countLabel.font = DEF_FontSize_14;
        _countLabel.textColor = getColor(@"666666");
        _countLabel.text = @"10";
        
        
        _moneyLabel = [[UILabel alloc] init];
        _moneyLabel.font = DEF_FontSize_14;
        _moneyLabel.textColor = getColor(@"323232");
        _moneyLabel.text = @"￥99.6";
        
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = getColor(dividerColor);
        
        [self sd_addSubviews:@[self.picImageView,self.nameLabel,self.countLabel,self.moneyLabel,self.lineView]];
        
        [self layOutFrame];
    }
    return self;
}

- (void)layOutFrame{
    
    ws(self)
    
    [self.picImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(UNIT_WIDTH(15));
        make.top.mas_equalTo(UNIT_HEIGHT(10));
        make.height.mas_equalTo(UNIT_HEIGHT(65));
        make.width.mas_equalTo(UNIT_WIDTH(65));
    }];
    
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakself.picImageView.mas_right).offset(UNIT_WIDTH(15));
        make.top.mas_equalTo(UNIT_HEIGHT(15));
        make.right.mas_equalTo(UNIT_WIDTH(-14));
    }];
    
    [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(weakself.picImageView.mas_right).offset(UNIT_WIDTH(15));
        make.bottom.mas_equalTo(UNIT_HEIGHT(-15));
        make.width.mas_equalTo(UNIT_HEIGHT(100));
    }];
    
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(UNIT_WIDTH(-14));
        make.bottom.mas_equalTo(UNIT_HEIGHT(-15));
        make.width.mas_equalTo(UNIT_HEIGHT(100));
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(weakself.moneyLabel.mas_bottom).offset(10);
        make.left.mas_equalTo(0);
        make.height.mas_equalTo(0.5);
        make.right.mas_equalTo(0);
    }];
    
}


@end
